package com.ysx.teacher.day20210910.client;

import com.ysx.teacher.day20210910.sm.Student;
import com.ysx.teacher.day20210910.sm.StudentDao;

public class StudentTest {


    public static void main(String[] args) {

        StudentDao dao = new StudentDao();

        // 静态的方法不能调用动态的方法
        StudentTest test = new StudentTest();
        test.init(dao);

        dao.login("sc","123");

        int maths =dao.findMaxMaths();

        double maxAverage =dao.findMaxAverage();
        dao.orderByAverage();

        dao.updateMathsByUserName("rabbit",77);

        dao.deleteStudent("rabbit");

    }

    public void init(StudentDao dao){

        Student student1=new Student("scott","123456",90,90,90);
        Student student2=new Student("frank","123456",80,80,80);
        Student student3=new Student("rabbit","123456",70,70,70);
        dao.addStudent(student1);
        dao.addStudent(student2);
        dao.addStudent(student3);
    }
}
